package com.sl.cdc.api.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

@Getter
@AllArgsConstructor
public enum CdcDataSourceEnum {
    MYSQL("mysql", "mysql", "io.debezium.connector.mysql.MySqlConnector");


    private String code;

    private String name;

    private String connector;

    public static CdcDataSourceEnum of(String dbTypeCode) {
        if (null == dbTypeCode) {
            return null;
        }
        return Arrays.stream(CdcDataSourceEnum.values()).filter(v -> {
            return v.getCode().equalsIgnoreCase(dbTypeCode);
        }).findFirst().orElse(null);
    }
}
